package net.xumf.support.auth;

import java.util.List;

public class VerificationUtil implements Verification {

    private static VerificationUtil instance;

    public static VerificationUtil getInstance() {
        if (null == instance) {
            synchronized (VerificationUtil.class) {
                if (null == instance) {
                    instance = new VerificationUtil();
                }
            }
        }
        return instance;
    }

    private VerificationUtil() {
    }

    private VerificationAbstract verificationAbstract;

    public <T extends VerificationAbstract> void setVerificationAbstract(T verificationAbstract) {
        this.verificationAbstract = verificationAbstract;
    }

    @Override
    public boolean hasRole(String role) {
        return verificationAbstract.hasRole(role);
    }

    @Override
    public boolean hasRoleAnd(List<String> roles) {
        return verificationAbstract.hasRoleAnd(roles);
    }

    @Override
    public boolean hasRoleOr(List<String> roles) {
        return verificationAbstract.hasRoleOr(roles);
    }

    @Override
    public boolean hasPermission(String permission) {
        return verificationAbstract.hasPermission(permission);
    }

    @Override
    public boolean hasPermissionsAnd(List<String> permissions) {
        return verificationAbstract.hasPermissionsAnd(permissions);
    }

    @Override
    public boolean hasPermissionsOr(List<String> permissions) {
        return verificationAbstract.hasPermissionsOr(permissions);
    }

    @Override
    public List<String> getRoles() {
        return verificationAbstract.getRoles();
    }

    @Override
    public List<String> getPermissions() {
        return verificationAbstract.getPermissions();
    }

    @Override
    public void setRoles(List<String> roles) {
        verificationAbstract.setRoles(roles);
    }

    @Override
    public void setPermissions(List<String> permissions) {
        verificationAbstract.setPermissions(permissions);
    }

    @Override
    public String getRoleKey() {
        return verificationAbstract.getRoleKey();
    }

    @Override
    public String getPermissionKey() {
        return verificationAbstract.getPermissionKey();
    }

    @Override
    public void clear() {
        verificationAbstract.clear();
    }
}
